home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- //
- // Creation Date: Dec 1, 1998
- // Author: rh
- //
- // Procedure Name:
- // AEreferenceTempate
- //
- // Description Name;
- // Creates the attribute editor controls for the reference node.
- //
- // Input Value:
- // nodeName
- //
- // Output Value:
- // None
- //
-
-
- global proc AErefFilenameNew(string $nodeAttr)
- {
- string $buffer[]; tokenize($nodeAttr, ".", $buffer);
- string $attr = $buffer[1];
-
- setUITemplate -pst attributeEditorTemplate;
- columnLayout ($attr+"Column");
- setParent ..;
- setUITemplate -ppt;
-
- AErefFilenameReplace($nodeAttr);
- }
-
-
- global proc AErefFilenameReplace(string $nodeAttr)
- {
- string $buffer[]; tokenize($nodeAttr, ".", $buffer);
- string $attr = $buffer[1];
-
- setParent ($attr+"Column");
-
- string $layoutName=`setParent -q`;
- int $oldCnt=`columnLayout -q -nch $layoutName`;
- string $dataAry[] = `listAttr -m $nodeAttr`;
- int $dataCnt = size($dataAry);
-
- for ($i = 0; $i < $dataCnt; $i++)
- {
- string $value = `getAttr ($nodeAttr+"["+$i+"]")`;
- string $rowLayoutName = $attr+"Row"+$i;
- string $textFieldName = $attr+"Text"+$i;
-
- if ($i < $oldCnt)
- {
- textField -e -text $value $textFieldName;
- connectControl $textFieldName ($nodeAttr+"["+$i+"]");
- }
- else
- {
- setUITemplate -pst attributeEditorTemplate;
- rowLayout -nc 1 -cw1 348 $rowLayoutName;
- textField -ed false -text $value $textFieldName;
- connectControl $textFieldName ($nodeAttr+"["+$i+"]");
- setParent ..;
- setUITemplate -ppt;
- }
- }
-
- for ($i = $dataCnt; $i < $oldCnt; $i++)
- {
- string $rowLayoutName = $attr+"Row"+$i;
-
- if (`rowLayout -exists $rowLayoutName`)
- {
- deleteUI -layout $rowLayoutName;
- }
- }
-
- setParent ..;
- }
-
-
- global proc AErefConnectListNew(string $nodeAttr)
- {
- string $buffer[]; tokenize($nodeAttr, ".", $buffer);
- string $attr = $buffer[1];
-
- setUITemplate -pst attributeEditorTemplate;
- columnLayout ($attr+"Column");
- setParent ..;
- setUITemplate -ppt;
-
- AErefConnectListReplace($nodeAttr);
- }
-
-
- global proc AErefConnectListReplace(string $nodeAttr)
- {
- string $buffer[]; tokenize($nodeAttr, ".", $buffer);
- string $attr = $buffer[1];
-
- setParent ($attr+"Column");
-
- string $layoutName=`setParent -q`;
- int $oldCnt=`columnLayout -q -nch $layoutName`;
- string $dataAry[] = `listAttr -m $nodeAttr`;
- int $dataCnt = size($dataAry) / 3;
-
- for ($i = 0; $i < $dataCnt; $i++)
- {
- string $refAttr = `getAttr ($nodeAttr+"["+$i+"].ca")`;
- string $srcPlugAry[] = `listConnections -s true -d false -p true ($nodeAttr+"["+$i+"].c")`;
- string $dstPlugAry[] = `listConnections -s false -d true -p true ($nodeAttr+"["+$i+"].c")`;
- string $btnCmd;
- string $text;
-
- if (size($srcPlugAry))
- {
- $btnCmd = ("disconnectAttr "+$srcPlugAry[0]+" "+$nodeAttr+"["+$i+"].c; ");
- $btnCmd += ("AErefConnectListReplace(\""+$nodeAttr+"\")");
- $text = ($refAttr+" <- "+$srcPlugAry[0]);
- }
- else if (size($dstPlugAry))
- {
- $btnCmd = ("disconnectAttr "+$nodeAttr+"["+$i+"].c "+$dstPlugAry[0]+"; ");
- $btnCmd += ("AErefConnectListReplace(\""+$nodeAttr+"\")");
- $text = ($refAttr+" -> "+$dstPlugAry[0]);
- }
- else
- {
- $btnCmd = "";
- $text = "";
- }
-
- string $rowLayoutName = $attr+"Row"+$i;
- string $btnName = $attr+"Btn"+$i;
- string $textFieldName = $attr+"Text"+$i;
-
- if ($i < $oldCnt)
- {
- button -e -c $btnCmd $btnName;
- textField -e -text $text $textFieldName;
- }
- else
- {
- setUITemplate -pst attributeEditorTemplate;
- rowLayout -nc 2 -ct2 right both $rowLayoutName;
- button -l "Disconnect" -w 100 -c $btnCmd $btnName;
- textField -ed false -text $text $textFieldName;
- setParent ..;
- setUITemplate -ppt;
- }
- }
-
- for ($i = $dataCnt; $i < $oldCnt; $i++)
- {
- string $rowLayoutName = $attr+"Row"+$i;
-
- if (`rowLayout -exists $rowLayoutName`)
- {
- deleteUI -layout $rowLayoutName;
- }
- }
-
- setParent ..;
- }
-
-
- global proc AErefMultiStrNew(string $nodeAttr)
- {
- string $buffer[]; tokenize($nodeAttr, ".", $buffer);
- string $attr = $buffer[1];
-
- setUITemplate -pst attributeEditorTemplate;
- columnLayout ($attr+"Column");
- setParent ..;
- setUITemplate -ppt;
-
- AErefMultiStrReplace($nodeAttr);
- }
-
-
- global proc AErefMultiStrReplace(string $nodeAttr)
- {
- string $buffer[]; tokenize($nodeAttr, ".", $buffer);
- string $attr = $buffer[1];
-
- setParent ($attr+"Column");
-
- string $layoutName=`setParent -q`;
- int $oldCnt=`columnLayout -q -nch $layoutName`;
- string $dataAry[] = `listAttr -m $nodeAttr`;
- int $dataCnt = size($dataAry);
-
- for ($i = 0; $i < $dataCnt; $i++)
- {
- string $value = `getAttr ($nodeAttr+"["+$i+"]")`;
- string $btnCmd = ("setAttr -type \"string\" "+$nodeAttr+"["+$i+"] \"\"");
- string $rowLayoutName = $attr+"Row"+$i;
- string $btnName = $attr+"Btn"+$i;
- string $textFieldName = $attr+"Text"+$i;
-
- if ($i < $oldCnt)
- {
- button -e -c $btnCmd $btnName;
- textField -e -text $value $textFieldName;
- connectControl $textFieldName ($nodeAttr+"["+$i+"]");
- }
- else
- {
- setUITemplate -pst attributeEditorTemplate;
- rowLayout -nc 2 -ct2 right both $rowLayoutName;
- button -l "Remove" -c $btnCmd -w 100 $btnName;
- textField -ed false -text $value $textFieldName;
- connectControl $textFieldName ($nodeAttr+"["+$i+"]");
- setParent ..;
- setUITemplate -ppt;
- }
- }
-
- for ($i = $dataCnt; $i < $oldCnt; $i++)
- {
- string $rowLayoutName = $attr+"Row"+$i;
-
- if (`rowLayout -exists $rowLayoutName`)
- {
- deleteUI -layout $rowLayoutName;
- }
- }
-
- setParent ..;
- }
-
-
- global proc AEreferenceTemplate(string $nodeName)
- {
- editorTemplate -beginScrollLayout;
-
- editorTemplate -beginLayout "File Names" -collapse true;
- editorTemplate -callCustom "AErefFilenameNew" "AErefFilenameReplace" "fn";
- editorTemplate -endLayout;
-
- editorTemplate -beginLayout "Connection List" -collapse true;
- editorTemplate -callCustom "AErefConnectListNew" "AErefConnectListReplace" "cl";
- editorTemplate -endLayout;
-
- editorTemplate -beginLayout "Set Attr List" -collapse true;
- editorTemplate -callCustom "AErefMultiStrNew" "AErefMultiStrReplace" "sl";
- editorTemplate -endLayout;
-
- editorTemplate -beginLayout "Add Attr List" -collapse true;
- editorTemplate -callCustom "AErefMultiStrNew" "AErefMultiStrReplace" "al";
- editorTemplate -endLayout;
-
- editorTemplate -beginLayout "Broken Connection List" -collapse true;
- editorTemplate -callCustom "AErefMultiStrNew" "AErefMultiStrReplace" "bl";
- editorTemplate -endLayout;
-
- editorTemplate -beginLayout "Parent List" -collapse true;
- editorTemplate -callCustom "AErefMultiStrNew" "AErefMultiStrReplace" "pl";
- editorTemplate -endLayout;
-
- // Include all base class and node attributes.
- //
- AEdependNodeTemplate $nodeName;
-
-
- // Suppressed attributes
- editorTemplate -suppress "fileNames";
- editorTemplate -suppress "connectionList";
- editorTemplate -suppress "setAttrList";
- editorTemplate -suppress "parentList";
- editorTemplate -suppress "addAttrList";
- editorTemplate -suppress "brokenConnectionList";
-
- editorTemplate -addExtraControls;
- editorTemplate -endScrollLayout;
-
- }
-